package m.jclecai.com.adapter.holder;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.text.TextUtils;
import android.widget.TextView;

import butterknife.BindView;
import m.jclecai.com.R;
import m.jclecai.com.bean.RecordsBean;

/**
 * Created by zd on 2017/9/29 0029.
 */

public class OrderDetailHolder extends ViewHolder {
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_type)
    TextView tvType;
    @BindView(R.id.tv_desc)
    TextView tvDesc;
    @BindView(R.id.tv_money)
    TextView tvMoney;
    @BindView(R.id.tv_get)
    TextView tvGet;

    @BindView(R.id.tv_price)
    TextView tvPrice;

    public OrderDetailHolder(Context context, @LayoutRes int resource) {
        super(context, resource);
    }

    public void init(RecordsBean bean) {
        String price = bean.getTicket_winmoney();
        tvPrice.setVisibility(INVISIBLE);
        if (!TextUtils.isEmpty(price) && Float.valueOf(price) != 0) {
            tvPrice.setText("奖金: " + price+"元");
            tvPrice.setVisibility(VISIBLE);
        }else{
            tvPrice.setText("奖金: " + 0.00+"元");
            tvPrice.setVisibility(VISIBLE);
        }
        tvType.setText(bean.getTicket_codes());
        tvTitle.setText("票号: "+bean.getTicket_no());
        ///tvDesc.setText(bean.getTicket_nums() + "注" + bean.getTicket_times() + "倍");

        String desc = bean.getTicket_result() + " " + bean.getTicket_nums() + "注 " + bean.getTicket_times() + "倍"+" 金额:" + bean.getTicket_totalmoney() + "元";
        tvDesc.setText(desc);
        tvMoney.setText("金额:" + bean.getTicket_totalmoney() + "元");
        tvGet.setText("单注:" + (TextUtils.isEmpty(bean.getTicket_onemoney()) ? "0" : bean.getTicket_onemoney() + "元"));
    }
}
